package com.yst.suivi.data.contrats;

import java.util.Collection;

import javax.ejb.CreateException;
import javax.ejb.EntityBean;

import com.yst.suivi.data.AbstractEntityBean;

/**
 * @author stolf
 * @ejb.bean name="Contrat" type="CMP" cmp-version="2.x" schema="contrat"
 *           local-jndi-name="ContratBean" view-type="local" primkey-field =
 *           "id" reentrant = "True"
 * @ejb.home generate="local"
 * @ejb.persistence table-name = "contrat"
 * @jboss.entity-command name = "key-generator"
 * @jboss.read-ahead eager-load-group = "most" strategy = "on-load"
 *                   page-size="25"
 * @jboss.load-group name="most"
 * @ejb.interface local-extends = "com.yst.suivi.data.util.NamedObject, javax.ejb.EJBLocalObject"
 * @ejb.finder signature="java.util.Collection findAll()" query="SELECT
 *             OBJECT(g) FROM contrat AS g"
 * 
 */
public abstract class ContratBean extends AbstractEntityBean implements EntityBean
{
	// select count(p.id), p.weeknumber, t.nom
	// from pointage p
	// inner join ACTIVITY a on a.id=p.ACTID
	// inner JOIN contrat t on a.CONTRATID=t.ID
	// group by p.WEEKNUMBER, t.nom
	/**
	 * @return
	 * @throws CreateException
	 * @ejb.create-method view-type = "local"
	 */
	public String ejbCreate() throws CreateException
	{
		return null;
	}

	public void ejbPostCreate()
	{
		// by default nothing to do
	}

	/**
	 * Return the primary key of the object
	 * 
	 * @ejb.interface-method view-type = "local"
	 * @ejb.persistence
	 * @jboss.jdbc-type type = "VARCHAR"
	 * @jboss.sql-type type = "VARCHAR(255)"
	 */
	public abstract String getId();

	/**
	 * Fix the primary key of the object. The method should be used only by the
	 * container
	 * 
	 * @ejb.interface-method view-type = "local"
	 */
	public abstract void setId(String id);

	/**
	 * Return the name of the object
	 * 
	 * @ejb.interface-method view-type = "local"
	 * @ejb.persistence
	 * @jboss.load-group name="most"
	 * @jboss.jdbc-type type = "VARCHAR"
	 * @jboss.sql-type type = "VARCHAR(255)"
	 */
	public abstract String getNom();

	/**
	 * Fix the name of the user. The method should be used only by the container
	 * 
	 * @ejb.interface-method view-type = "local"
	 */
	public abstract void setNom(String nom);

	/**
	 * Return the reference of the commande
	 * 
	 * @ejb.interface-method view-type = "local"
	 * @ejb.persistence
	 * @jboss.load-group name="most"
	 * @jboss.jdbc-type type = "VARCHAR"
	 * @jboss.sql-type type = "VARCHAR(255)"
	 */
	public abstract String getRefCmd();

	/**
	 * Fix the reference of the commande.
	 * 
	 * @ejb.interface-method view-type = "local"
	 */
	public abstract void setRefCmd(String refCmd);

	/**
	 * Return the code of the workpackage
	 * 
	 * @ejb.interface-method view-type = "local"
	 * @ejb.persistence
	 * @jboss.load-group name="most"
	 */
	public abstract String getCode();

	/**
	 * Fix the code of the workpackage.
	 * 
	 * @ejb.interface-method view-type = "local"
	 */
	public abstract void setCode(String code);

	/**
	 * Return the contractor of the workpackage
	 * 
	 * @ejb.interface-method view-type = "local"
	 * @ejb.persistence
	 * @jboss.load-group name="most"
	 * @jboss.jdbc-type type = "VARCHAR"
	 * @jboss.sql-type type = "VARCHAR(255)"
	 */
	public abstract String getContractor();

	/**
	 * Fix the contractor of the workpackage.
	 * 
	 * @ejb.interface-method view-type = "local"
	 */
	public abstract void setContractor(String contractor);

	/**
	 * Return number of working day of the work package
	 * 
	 * @ejb.interface-method view-type = "local"
	 * @ejb.persistence
	 * @jboss.load-group name="most"
	 */
	public abstract Integer getWorkload();

	/**
	 * Fix the number of working day of the work package.
	 * 
	 * @ejb.interface-method view-type = "local"
	 */
	public abstract void setWorkload(Integer workload);

	/**
	 * La methode lie le contrat a un projet
	 * 
	 * @return
	 * @ejb.relation name="contrat-projet" role-name = "ContratProjet"
	 *               target-multiple = "yes" target-ejb="Project"
	 * @jboss.relation-mapping style = "relation-table"
	 * @jboss.relation-table table-name = "LnkContratProject"
	 * @jboss.relation fk-column = "idContrat" related-pk-field = "id"
	 * 
	 * @ejb.interface-method view-type = "local"
	 */
	public abstract Collection getProject();

	/**
	 * La methode lie le contrat a un projet
	 * 
	 * @param plf
	 * @ejb.interface-method view-type = "local"
	 */
	public abstract void setProject(Collection plf);

	/**
	 * Etat du projet. Selon l'etat, il peut etre plus ou moins modifiee
	 * 
	 * @ejb.interface-method view-type = "local"
	 * @ejb.persistence
	 * @jboss.load-group name="most"
	 */
	public abstract int getStatus();

	/**
	 * Positionne l'etat du projet
	 * 
	 * @ejb.interface-method view-type = "local"
	 */
	public abstract void setStatus(int status);
}
